lspath <- function(x, y, nlam, flmin, ulam, isd, eps, dfmax, pmax, 
    jd, maxit, lam2, penalty, a, nobs, nvars, vnames) {
    #################################################################################
    # call Fortran core
    if (penalty == "scad") 
        fit <- .Fortran("elsscadNET", a, lam2, nobs, nvars, as.double(x), as.double(y), 
            jd, dfmax, pmax, nlam, flmin, ulam, eps, isd, maxit, nalam = integer(1), 
            b0 = double(nlam), beta = double(pmax * nlam), ibeta = integer(pmax), 
            nbeta = integer(nlam), alam = double(nlam), npass = integer(1), 
            jerr = integer(1), PACKAGE = "conreg")
    if (penalty == "mcp") 
        fit <- .Fortran("elsmcpNET", a, lam2, nobs, nvars, as.double(x), as.double(y), 
            jd, dfmax, pmax, nlam, flmin, ulam, eps, isd, maxit, nalam = integer(1), 
            b0 = double(nlam), beta = double(pmax * nlam), ibeta = integer(pmax), 
            nbeta = integer(nlam), alam = double(nlam), npass = integer(1), 
            jerr = integer(1), PACKAGE = "conreg")
    if (penalty == "sica") 
        fit <- .Fortran("lssicaNET", a, lam2, nobs, nvars, as.double(x), as.double(y), 
            jd, dfmax, pmax, nlam, flmin, ulam, eps, isd, maxit, nalam = integer(1), 
            b0 = double(nlam), beta = double(pmax * nlam), ibeta = integer(pmax), 
            nbeta = integer(nlam), alam = double(nlam), npass = integer(1), 
            jerr = integer(1), PACKAGE = "conreg")
    #################################################################################
    # output
    outlist <- getoutput(fit, maxit, pmax, nvars, vnames)
    outlist <- c(outlist, list(npasses = fit$npass, jerr = fit$jerr))
    class(outlist) <- c("lspath")
    outlist
} 
